.include _hwdefs.asm
.include _clrdefs.asm

;; Variables
.org SYSRAM
stack: byte[128]

;; Main
.org SYSROM
lds stack
jss cls

hlt

;; Clear the screen
FUNC cls:
  ldp screen.char
  ldc $00 ;; Blank
  ldq screen.color
  ldb CLR_BLACK ;; Black
  .cls_loop: {
    stc *p++
    stb *q++
    lda pl
    cmp (lo(COLOR))
    jnz .cls_loop
    lda ph
    cmp (hi(COLOR))
  jnz }
rts
